include("julia.jl")
using .JuliaSet

include("utils/utils.jl")
using .Utils

include("utils/renders.jl")
using .Renderer

include("utils/stepper.jl")
using .Stepper

using Printf
using Images



C = -0.81 + 0.67im
MAX_STEP = 25
MAP_SIZE = 720
map = initMap(MAP_SIZE)



function vary_iter()
    for step in 1:MAX_STEP
        if step > 1
            initMapValue(map)
        end
        
        for i in 1:step
            iterateMap(map) do z
                standard_stepper(z, C)
            end
        end

        myImg = mapToImage(map) do c::Complex{Float64}
            single_ratio_colored_magnitude_renderer(c)
        end

        save_img("out/$step.png", myImg, true)
    end
end


function vary_real()
    counter = 0
    for real in -2 : 0.04 : 2
        counter += 1
        if counter > 1
            initMapValue(map)
        end
        for step in 1 : MAX_STEP
            iterateMap(map) do z
                standard_stepper(z, Complex(real, imag(C))) 
            end
        end
        myImg = mapToImage(map) do c::Complex{Float64}
            real_imag_color_renderer(c)
        end
    
        save_img("out/$counter.png", myImg, true)
    end
end

function vary_imag()
    counter = 0
    for imag in -2 : 0.04 : 2
        counter += 1
        if counter > 1
            initMapValue(map)
        end
        for step in 1 : MAX_STEP
            iterateMap(map) do z
                standard_stepper(z, Complex(real(C), imag))
            end
        end
        myImg = mapToImage(map) do c::Complex{Float64}
            magnitude_to_luminance_renderer(c)
        end
    
        save_img("out/$counter.png", myImg, true)
    end
end


vary_real()

